Skip to content

Conversation

devhaozi
Copy link

@devhaozi devhaozi commented Sep 5, 2024

This PR enables lua-nginx-module to be compiled with AWS-LC, tested on OpenResty 1.27.1.1.
image

I hereby granted the copyright of the changes in this pull request
to the authors of this lua-nginx-module project.

@zhuizhuhaomeng
Copy link
Contributor

@devhaozi We need to add test cases to cover this new feature

@devhaozi
Copy link
Author

devhaozi commented Sep 6, 2024

@devhaozi We need to add test cases to cover this new feature

Add it to .travis.yml like BoringSSL?

@zhuizhuhaomeng
Copy link
Contributor

We don't need to run the tests in t/ directory.
Would you please add a script in util that will link AWS-LC SSL Library

@devhaozi
Copy link
Author

devhaozi commented Sep 6, 2024

@zhuizhuhaomeng tests added.

@devhaozi

This comment was marked as resolved.

@mergify mergify bot removed the needs-test-cases label Sep 6, 2024
Copy link

mergify bot commented Sep 18, 2024

This pull request is now in conflict :(

@mergify mergify bot added the conflict label Sep 18, 2024
}

#ifdef SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE
#if defined(SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE) || defined(OPENSSL_IS_AWSLC)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS-LC supports SSL_get_tlsext_status_type, but does not define SSL_CTRL_GET_TLSEXT_STATUS_REQ_TYPE.

Comment on lines +82 to +86
#if defined(OPENSSL_IS_BORINGSSL)
*err = "BoringSSL does not support SSL_export_keying_material_early";
return NGX_ERROR;
#elif defined(LIBRESSL_VERSION_NUMBER)
*err = "LibreSSL does not support SSL_export_keying_material";
*err = "LibreSSL does not support SSL_export_keying_material_early";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed some string errors.

const u_char *context, size_t ctxlen, int use_ctx, char **err)
{
#if defined(OPENSSL_IS_BORINGSSL) || OPENSSL_VERSION_NUMBER < 0x10101000L
#if defined(OPENSSL_IS_BORINGSSL) && !defined(OPENSSL_IS_AWSLC)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS-LC supports SSL_export_keying_material but does not support SSL_export_keying_material_early due to performance reasons, see aws/aws-lc@94b2871

Comment on lines +547 to +549
#elif defined(OPENSSL_IS_AWSLC)
*err = "AWS-LC does not support by ssl_client_hello_by_lua*";
return NGX_ERROR;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS-LC does not support SSL_client_hello_get0_ext, and therefore does not support ssl_client_hello_by_lua*.
From the test cases I think BoringSSL also does not support SSL_client_hello_get0_ext, but it is not shown here?

#- if [ -n "$PCRE2_VER" ]; then tar zxf download-cache/pcre2-$PCRE2_VER.tar.gz; cd pcre2-$PCRE2_VER/; ./configure --prefix=$PCRE2_PREFIX --enable-jit --enable-utf > build.log 2>&1 || (cat build.log && exit 1); make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1); sudo PATH=$PATH make install > build.log 2>&1 || (cat build.log && exit 1); cd ..; fi
#- if [ -n "$OPENSSL_VER" ]; then tar zxf download-cache/openssl-$OPENSSL_VER.tar.gz; cd openssl-$OPENSSL_VER/; patch -p1 < ../../openresty/patches/openssl-$OPENSSL_PATCH_VER-sess_set_get_cb_yield.patch; ./config shared enable-ssl3 enable-ssl3-method -g --prefix=$OPENSSL_PREFIX --libdir=lib -DPURIFY > build.log 2>&1 || (cat build.log && exit 1); make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1); sudo make PATH=$PATH install_sw > build.log 2>&1 || (cat build.log && exit 1); cd ..; fi
- if [ -n "$BORINGSSL" ]; then sudo mkdir -p /opt/ssl && sudo tar -C /opt/ssl -xf boringssl-20230902-x64-focal.tar.gz --strip-components=1; fi
- if [ -n "$AWSLC" ]; then sudo mkdir -p /opt/ssl; sudo sh util/build-aws-lc.sh; export ENABLE_AWS_LC="-DOPENSSL_IS_BORINGSSL "; fi
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AWS-LC is close to BoringSSL, so can use -DOPENSSL_IS_BORINGSSL directly.

Comment on lines +640 to +642
#elif defined(OPENSSL_IS_AWSLC)
*err = "AWSLC does not support by ssl_client_hello_by_lua*";
return NGX_ERROR;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

@devhaozi
Copy link
Author

@zhuizhuhaomeng Ready for review, can you take a moment to look at this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants